import { useNavigate } from 'react-router-dom'
import Button from '@/component/button/Button'
import './me.less'
import { useReducer, useState } from 'react'

const Me = () => {
  const navigation = useNavigate()
  const [, forceRender] = useReducer(c => c + 1, 0)
  const goLogin = () => {
    navigation('/login')
  }
  const [username, setUserName] = useState({ username: '123' })
  const changeUserName = () => {
    username.username = '12345'
    setUserName(username)
  }
  console.log('rerender')
  return (
    <>
      <Button onClick={goLogin} size="large">
        123
      </Button>
      <div className="me" onClick={forceRender}>
        123
      </div>
      <div onClick={changeUserName}>{username.username}</div>
    </>
  )
}

export default Me
